<?php
/**
 * 客户自定义表排序
 */

/*$auth = new \app\admin\library\Auth();
if($auth->check('facrm/customer/record/add')){
	$customer_link = 'facrm/customer/record/add/ids/';
}elseif($auth->check('facrm/customer/record/index')){
	$customer_link = 'facrm/customer/index/edit/ids/';
}else{
	$customer_link = '';
}*/



return array(

    array("field" => 'id', "title" => '客户ID'),

    array("field" => 'name', "title" => '客户名称', "operate" => "LIKE", "align" => 'left', 'customField' => 'tags', "class" => "tabletd",
        "formatter" => '(function (value, row, index) {
  value=\'<a href="javascript:void(0);" data-url="facrm/customer/index/detail/ids/\' + row.id
  +\'" data-area="[&quot;98%&quot;,&quot;98%&quot;]" class="btn-addtabs" data-toggle="tooltip"  data-original-title="\'+ value+\'"  data-title="\'+ value+\'">\'+ value+\'</a>\';
 

  return value +
  \'<div >\' + Table.api.formatter.flag.call(this, row[\'tags\'], row, index) + \'</div>\';
  })',"cellStyle" => '(function(value, row, index, field){return {css: {"max-width":"200px"}};})'),

    array("field" => 'level', "title" => '关注度', "formatter" => "Table.api.formatter.label", "searchList" => 'levelList', "sortable" => true),

    array("field" => 'owner_user_id', "title" => '负责人', "addclass" => "selectpage", "class" => "tabletd", "cellStyle" => "(function(value, row, index, field){return {css: { \"max-width\":\"200px\"}};})",
        'formatter' => "(function (v, r) {if (!r.owner_user) return '-';return r.owner_user.nickname;})",
        'extend' => 'data-source="facrm/common/selectpage/model/admin?type=children" data-field="nickname" data-orderBy="id desc"'
    ),
	array("field" => 'owner_user_ids', "title" => '助教', "operate" => "LIKE", "addclass" => "selectpage", "class" => "tabletd",
        'formatter' => "(function (v, r) {if (!r.owner_users) return '-';return r.owner_users;})",
	  	'extend' => 'data-source="facrm/common/selectpage/model/admin?type=in" data-field="nickname" data-orderBy="id desc"'
    ),

	array("field" => 'source', "title" => '来源', "formatter" => "Table.api.formatter.normal", "searchList" => 'sourceList'),
	array("field" => 'spread_uid', "title" => '推荐人', "addclass" => "selectpage", "class" => "tabletd", "cellStyle" => "(function(value, row, index, field){
         return {css: { \"max-width\":\"200px\"}};
                    })",
        'formatter' => "(function (v, r) {
            if (!r.spread_user) return '-';
            return r.spread_user.nickname;})",
        'extend' => 'data-source="facrm/common/selectpage/model/admin?type=children" data-field="nickname" data-primary-key="uid" data-orderBy="id desc"'
    ),

	array("field" => 'area_text', "title" => '地区'),
	array("field" => 'follow_status', "title" => '阶段', "formatter" => "Table.api.formatter.normal", "searchList" => 'followStatusList'),
	array("field" => 'deal_status', "title" => '成交状态', "formatter" => "Table.api.formatter.normal", "searchList" => 'deal_status'),
	array("field" => 'service', "title" => '当前服务', "formatter" => "Table.api.formatter.content", "class" => "autocontent", "hover" => true),
	array("field" => 'keynote', "title" => '近期重点', "formatter" => "Table.api.formatter.content", "class" => "autocontent", "hover" => true),
	array("field" => 'survey1_count', "title" => '调研问卷', 'searchList' => ['已填','未填'], "formatter" => "(function (value, row, index) { return value>0 ? '<div style=\"color:#2F4056\">【已填】</div>' : '<div style=\"color: #e2e2e2\">【未填】</div>'})"),

    array("field" => 'next_time', "title" => '下次跟进', "operate" => "RANGE", "sortable" => true, "formatter" => "Table.api.formatter.datetime", "addclass" => "datetimerange", "extend" => 'autocomplete="off" data-time-picker="true"'),
    array("field" => 'follow_time', "title" => '最近跟进', "operate" => "RANGE", "sortable" => true, "formatter" => "Table.api.formatter.datetime", "addclass" => "datetimerange", "extend" => 'autocomplete="off" data-time-picker="true"'),
	array("field" => 'create_time', "title" => '创建时间', "sortable" => true, "formatter" => "Table.api.formatter.datetime", "addclass" => "datetimerange", "extend" => 'autocomplete="off" data-time-picker="true"'),



);
